package myEddy.core;

import java.util.Comparator;

import myEddy.tuple.Tuple;

/**
 * To order the tuples in the priority queue
 */
public class TupleComparator implements Comparator<Tuple>
{

	/**
	 * The more the bitmap has true bits, the more important it is.
	 */
	@Override
	public int compare(Tuple arg0, Tuple arg1) {
		
		if( arg0.getDoneBitmap().cardinality() < arg1.getDoneBitmap().cardinality())
		{ return 1; }
		else if ( arg0.getDoneBitmap().cardinality() > arg1.getDoneBitmap().cardinality())
		{ return -1; }
		
		//The same
		return 0;
	}

}
